package cn.fl.carloan.controller;

import java.util.Date;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


import cmm.user.facade.system.api.ISysOrgApiService;
import cmm.user.facade.system.api.ISysUsrApiService;
import cmm.user.facade.system.dto.SysOrgDTO;
import cmm.user.facade.system.dto.SysUsrDTO;
import cn.cmm.base.framework.utils.CollectionUtils;
import cn.cmm.base.framework.utils.DateUtils;
import cn.fl.carloan.service.IOdrShopClueInfoService;
import cn.fl.carloan.vo.OdrShopClueInfoVO;
import cn.fl.framework.base.context.CurrentThreadContext;
import cn.fl.system.constant.SysLogConstant;
import fl.carloan.facade.carloan.api.IOdrCstMgrRegionRApiService;
import fl.carloan.facade.carloan.condition.OdrCstMgrRegionRQC;
import fl.carloan.facade.carloan.condition.OdrShopClueInfoQC;
import fl.carloan.facade.carloan.constant.OdrShopClueInfoConstant;
import fl.carloan.facade.carloan.dto.OdrCstMgrRegionRDTO;
import fl.carloan.facade.carloan.enums.ShopClueCdEnums;
import fl.spl.facade.spl.api.ISplInfoApiService;
import fl.spl.facade.spl.dto.SplInfoDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.alibaba.fastjson.JSONObject;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import cn.cmm.base.framework.utils.BaseLogUtils;
import cn.cmm.base.framework.utils.StringUtils;
import cmm.mid.core.framework.page.DataResultVO;
import cmm.mid.core.framework.page.KeyValueVO;
import cmm.mid.core.framework.page.ListPageVO;
import cmm.mid.core.framework.page.Pager;
import cmm.web.core.framework.controller.BaseController;
import cn.cmm.base.framework.constant.BaseConstant;
import cn.cmm.base.framework.exception.BaseException;

/**
 * @Description: 商家线索管理表 控制层
 */
@Controller
@RequestMapping("/carloan/odrshopclueinfo")
public class OdrShopClueInfoController extends BaseController {

    private static final Logger logger = LoggerFactory.getLogger(OdrShopClueInfoController.class);

    @Autowired
    private ISplInfoApiService splInfoApiService;

    @Autowired
    private ISysUsrApiService sysUsrApiService;

    @Autowired
    private IOdrCstMgrRegionRApiService odrCstMgrRegionRApiService;

    @Autowired
    private ISysOrgApiService sysOrgApiService;


    /**
     * OdrShopClueInfo 服务层BEAN
     */
    @Autowired
    private IOdrShopClueInfoService odrShopClueInfoService;

    /**
     * 到列表页面
     */
    @RequestMapping(value = "/toListPage.do", method = {RequestMethod.GET})
    public ModelAndView toListPage(HttpServletRequest request, HttpServletResponse response) {
        Long startTm = System.currentTimeMillis();
        BaseLogUtils.info(logger, "toListPage", "加载列表页面.请求参数：" + this.getRequestParameter(request), CurrentThreadContext.getCurrentUserName());

        ModelAndView view = new ModelAndView("carloan/odrshopclueinfo/odrShopClueInfoList");
        
        List<KeyValueVO> odrShopClueStatusList =this.odrShopClueInfoService.searchStatusCdList(OdrShopClueInfoConstant.ODR_SHOP_CLUE_STS_CD);
        view.addObject("odrShopClueStatusList", odrShopClueStatusList);
        Long endTm = System.currentTimeMillis();
        BaseLogUtils.info(logger, "toListPage", "加载列表页面.耗时：" + (endTm - startTm), CurrentThreadContext.getCurrentUserName());
        return view;
    }

    /**
     * 到新增修改页面
     */
    @RequestMapping(value = "/toAddPage.do", method = {RequestMethod.GET, RequestMethod.POST})
    public ModelAndView toAddPage(HttpServletRequest request, HttpServletResponse response) {
        Long startTm = System.currentTimeMillis();
        BaseLogUtils.info(logger, "toAddPage", "加载新增.请求参数：" + this.getRequestParameter(request), CurrentThreadContext.getCurrentUserName());

        ModelAndView view = new ModelAndView("cn/fl/odrShopClueInfo/odrShopClueInfoAdd");

        Long endTm = System.currentTimeMillis();
        BaseLogUtils.info(logger, "toAddPage", "加载新增.耗时：" + (endTm - startTm), CurrentThreadContext.getCurrentUserName());
        return view;
    }

    /**
     * 到修改页面
     */
    @RequestMapping(value = "/toModifyPage.do", method = {RequestMethod.GET, RequestMethod.POST})
    public ModelAndView toModifyPage(HttpServletRequest request, HttpServletResponse response) {
        Long startTm = System.currentTimeMillis();
        BaseLogUtils.info(logger, "toAddPage", "加载修改页面.请求参数：" + this.getRequestParameter(request), CurrentThreadContext.getCurrentUserName());

        String id = request.getParameter("id");
        ModelAndView view = new ModelAndView("cn/fl/odrShopClueInfo/odrShopClueInfoModify");
        view.addObject("id", id);
        Long endTm = System.currentTimeMillis();
        BaseLogUtils.info(logger, "toAddPage", "加载修改.耗时：" + (endTm - startTm), CurrentThreadContext.getCurrentUserName());
        return view;
    }

    /**
     * 到详情页面
     */
    @RequestMapping(value = "/toDetailPage.do", method = {RequestMethod.GET})
    public ModelAndView toDetailPage(HttpServletRequest request, HttpServletResponse response) {
        Long startTm = System.currentTimeMillis();
        BaseLogUtils.info(logger, "toDetailPage", "加载例子详细页面.请求参数：" + this.getRequestParameter(request), CurrentThreadContext.getCurrentUserName());

        String id = request.getParameter("id");
        ModelAndView view = new ModelAndView("cn/fl/odrShopClueInfo/odrShopClueInfoDetail");
        view.addObject("id", id);

        Long endTm = System.currentTimeMillis();
        BaseLogUtils.info(logger, "toDetailPage", " 加载例子详细页面.耗时：" + (endTm - startTm), CurrentThreadContext.getCurrentUserName());
        return view;
    }

    /**
     * (商家线索)初始化列表
     */
    @SuppressWarnings("unchecked")
    @RequestMapping(value = "/initList.do", method = {RequestMethod.GET})
    @ResponseBody
    public Object initList(HttpServletRequest request, HttpServletResponse response) {
        Long startTm = System.currentTimeMillis();
        BaseLogUtils.info(logger, "initList", "加载列表页面.请求参数：" + this.getRequestParameter(request), CurrentThreadContext.getCurrentUserName());

        String splNm = request.getParameter("splNm");				//商家姓名
        String contactsMp = request.getParameter("contactsMp");		//商家手机号
        String splAddressPr = request.getParameter("rgnProvCd");	//经销商省
        String splAddressCy = request.getParameter("rgnCityCd");	//经销商市
        String status = request.getParameter("status");				//跟进状态
        String cstMgrNm = request.getParameter("cstMgrNm");			//客户经理姓名
        String startCrtTm = request.getParameter("startCrtTm");		//线索创建时间-开始时间
        String endCrtTm = request.getParameter("endCrtTm");			//线索创建时间-结束时间
        
        String currentPage = request.getParameter("page");
        String pageSize = request.getParameter("pagesize");
        Pager page = new Pager();
        if (StringUtils.isNotEmpty(currentPage)) {
            page.setCurrentPage(Integer.parseInt(currentPage));
        }

        if (StringUtils.isNotEmpty(pageSize)) {
            page.setEveryPage(Integer.parseInt(pageSize));
        }

        OdrShopClueInfoQC qc = new OdrShopClueInfoQC();
        if (StringUtils.isNotEmpty(splNm)) {
            qc.setSplNm(splNm);
        }
        if (StringUtils.isNotEmpty(contactsMp)) {
            qc.setContactsMp(contactsMp);
        }
        if (StringUtils.isNotEmpty(splAddressPr)) {
        	qc.setSplAddressPr(splAddressPr);
        }
        if (StringUtils.isNotEmpty(splAddressCy)) {
        	qc.setSplAddressCy(splAddressCy);
        }
        if (StringUtils.isNotEmpty(status)) {
        	qc.setStatus(status);
        }
        if (StringUtils.isNotEmpty(cstMgrNm)) {
        	qc.setCstMgrNm(cstMgrNm);
        }
        if (StringUtils.isNotEmpty(startCrtTm)) {
        	qc.setStartCrtTm(DateUtils.formatStringToDate(startCrtTm, DateUtils.YYYY_MM_DD));
        }
        if (StringUtils.isNotEmpty(endCrtTm)) {
        	qc.setEndCrtTm(DateUtils.formatStringToDate(endCrtTm, DateUtils.YYYY_MM_DD));
        }
        
        page.setCondition(qc);

        Pager pager = new Pager();
        pager = this.odrShopClueInfoService.searchListPage(page);
        List<OdrShopClueInfoVO> list = (List<OdrShopClueInfoVO>) pager.getResultList();
        ListPageVO<OdrShopClueInfoVO> listPage = new ListPageVO<OdrShopClueInfoVO>(list, pager.getTotalCount());
        Long endTm = System.currentTimeMillis();
        BaseLogUtils.info(logger, "initList", "加载列表页面.耗时：" + (endTm - startTm), CurrentThreadContext.getCurrentUserName());
        return listPage;
    }

    /**
     * 新增
     */
    @RequestMapping(value = "/add.do", method = {RequestMethod.POST})
    @ResponseBody
    public Object add(HttpServletRequest request, HttpServletResponse response) throws BaseException {
        Long startTm = System.currentTimeMillis();
        BaseLogUtils.info(logger, "add", "新增对象.请求参数：" + this.getRequestParameter(request), CurrentThreadContext.getCurrentUserName());

        String usrId = request.getParameter("usrId");
        String splId = request.getParameter("splId");
        String sysCd = request.getParameter("sysCd");
        String orgCd = request.getParameter("orgCd");
        String resCd = request.getParameter("resCd");
        String shareType = request.getParameter("shareType");
        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, "新增成功!");
        if (StringUtils.isEmpty(usrId)) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo("用户id不能为空！");
            return result;
        }
        if (StringUtils.isEmpty(splId)) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo("供应商id不能为空！");
            return result;
        }
        if (StringUtils.isEmpty(sysCd)) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo("系统代码不能为空！");
            return result;
        }
        if (StringUtils.isEmpty(orgCd)) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo("组织机构代码不能为空！");
            return result;
        }
        if (StringUtils.isEmpty(resCd)) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo("数据来源渠道代码不能为空！");
            return result;
        }
        OdrShopClueInfoVO entity = null;
        try {
            SplInfoDTO splInfoDTO = splInfoApiService.selectSplInfoById(Long.valueOf(splId));
            SysUsrDTO sysUsrDTO = sysUsrApiService.selectSysUsrById(Long.valueOf(usrId), sysCd, orgCd);
            entity = new OdrShopClueInfoVO();
            entity.setUsrId(usrId);
            entity.setSplId(splId);
            entity.setResCd(resCd);
            entity.setShareType(shareType);
            entity.setSplNm(splInfoDTO.getSplNm());
            entity.setContactsNm(sysUsrDTO.getUsrNm());
            entity.setContactsMp(sysUsrDTO.getMp());
            entity.setSplAddressPr(splInfoDTO.getRgnPrCd());
            entity.setSplAddressCy(splInfoDTO.getRgnCyCd());
            // 1：待跟进
            // 2：未接通
            // 3：已流转
            // 4：已废弃
            entity.setStatus("" + ShopClueCdEnums.wait_flow);
            //获取客户经理相关信息
            OdrCstMgrRegionRQC odrCstMgrRegionRQC = new OdrCstMgrRegionRQC();
            odrCstMgrRegionRQC.setRgnPrCd(splInfoDTO.getRgnPrCd());
            odrCstMgrRegionRQC.setRgnCyCd(splInfoDTO.getRgnCyCd());
            odrCstMgrRegionRQC.setIsDel(0);
            List<OdrCstMgrRegionRDTO> odrCstMgrRegionRDTOS = odrCstMgrRegionRApiService.searchOdrCstMgrRegionRList(odrCstMgrRegionRQC);
            if (CollectionUtils.isNotEmpty(odrCstMgrRegionRDTOS)) {
                OdrCstMgrRegionRDTO odrCstMgrRegionRDTO = odrCstMgrRegionRDTOS.get(0);
                entity.setCstMgrNm(odrCstMgrRegionRDTO.getCstMgrNm()+"_"+odrCstMgrRegionRDTO.getCstMgrOrgCd());
                //获取客户经理组织机构代码
                String cstMgrOrgCd = odrCstMgrRegionRDTO.getCstMgrOrgCd();
                //根据客户经理的组织机构代码查询客户经理所在的分公司的代码
                SysOrgDTO sysOrgDTO = sysOrgApiService.selectSysOrgByOrgCd(cstMgrOrgCd, sysCd);
                String mgrOrgCd = sysOrgDTO.getOrgCd();
                //判断是否是省公司
                if ("3".equals(sysOrgDTO.getOrgTypCd())) {
                    entity.setRgnPrCd(sysOrgDTO.getOrgCd());
                } else if ("4".equals(sysOrgDTO.getOrgTypCd())) {
                    //如果是分公司就查询省公司code
                    SysOrgDTO parentOrd = sysOrgApiService.selectById(sysOrgDTO.getOrgPid());
                    entity.setRgnPrCd(parentOrd.getOrgCd());
                    entity.setRgnCyCd(sysOrgDTO.getOrgCd());
                }
            }
            entity.setCrtTm(new Date());
            entity.setIsDel(0);
            Long id = this.odrShopClueInfoService.add(entity);
            result.setData(id);
            BaseLogUtils.info(logger, "add", "新增数据.[id=" + id + "] DATA:" + JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
        } catch (BaseException ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(ex.getMessage());
            BaseLogUtils.info(logger, "add", "新增对象失败,name[" + usrId + "].", CurrentThreadContext.getCurrentUserName(), ex);
        } catch (Exception ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo("系统错误,请联系管理员!");
            BaseLogUtils.error(logger, "add", "新增对象失败,name[" + usrId + "].", CurrentThreadContext.getCurrentUserName(), ex);
        }
        Long endTm = System.currentTimeMillis();
        BaseLogUtils.info(logger, "add", "新增对象.耗时：" + (endTm - startTm), CurrentThreadContext.getCurrentUserName());
        return result;
    }

    /**
     * 修改
     */
    @RequestMapping(value = "/modify.do", method = {RequestMethod.POST})
    @ResponseBody
    public Object modify(HttpServletRequest request, HttpServletResponse response) throws BaseException {
        Long startTm = System.currentTimeMillis();
        BaseLogUtils.info(logger, "modify", "修改对象.请求参数：" + this.getRequestParameter(request), CurrentThreadContext.getCurrentUserName());

        String id = request.getParameter("id");
        String name = request.getParameter("name");
        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, "修改成功!");
        if (StringUtils.isEmpty(id)) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo("数据不存在!");
            BaseLogUtils.info(logger, "modify", "修改数据,主键不存在.[id=" + id + "]", CurrentThreadContext.getCurrentUserName());
            return result;
        }
        OdrShopClueInfoVO entity = null;
        try {
            entity = new OdrShopClueInfoVO();
            entity.setId(Long.valueOf(id));
            //entity.setName(name);
            //TODO ADD PARAM
            boolean success = this.odrShopClueInfoService.modify(entity);
            if (!success) {
                result.setSuccess(BaseConstant.IS_YESNO_NO);
                result.setInfo("修改失败!");
                BaseLogUtils.info(logger, "modify", "修改失败.[id=" + id + "] DATA:" + JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
            }
            BaseLogUtils.info(logger, "modify", "修改成功.[id=" + id + "] DATA:" + JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
        } catch (BaseException ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(ex.getMessage());
            BaseLogUtils.info(logger, "modify", "修改对象失败,id[" + id + "].", CurrentThreadContext.getCurrentUserName(), ex);
        } catch (Exception ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo("系统错误,请联系管理员!");
            BaseLogUtils.error(logger, "modify", "修改对象失败,id[" + id + "].", CurrentThreadContext.getCurrentUserName(), ex);
        }

        Long endTm = System.currentTimeMillis();
        BaseLogUtils.info(logger, "modify", "修改对象.耗时：" + (endTm - startTm), CurrentThreadContext.getCurrentUserName());

        return result;
    }

    /**
     * 删除数据
     */
    @RequestMapping(value = "/removeById.do", method = {RequestMethod.POST})
    @ResponseBody
    public DataResultVO removeById(HttpServletRequest request, HttpServletResponse response) throws BaseException {
        Long startTm = System.currentTimeMillis();
        BaseLogUtils.info(logger, "remove", "移除对象.请求参数：" + this.getRequestParameter(request), CurrentThreadContext.getCurrentUserName());

        String id = request.getParameter("id");
        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, "删除成功!");
        if (StringUtils.isEmpty(id)) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo("主键不能为空!");
            return result;
        }
        try {
            this.odrShopClueInfoService.removeById(Long.valueOf(id));
            BaseLogUtils.info(logger, "removeById", "删除数据.[id=" + id + "]", CurrentThreadContext.getCurrentUserName());
        } catch (BaseException ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(ex.getMessage());
            BaseLogUtils.info(logger, "remove", "移除对象失败,主键[" + id + "].", CurrentThreadContext.getCurrentUserName(), ex);
        } catch (Exception ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo("系统错误,请联系管理员!");
            BaseLogUtils.error(logger, "remove", "移除对象失败,主键[" + id + "].", CurrentThreadContext.getCurrentUserName(), ex);
        }

        Long endTm = System.currentTimeMillis();
        BaseLogUtils.info(logger, "remove", "移除对象.耗时：" + (endTm - startTm), CurrentThreadContext.getCurrentUserName());

        return result;
    }

    /**
     * 得到一条记录
     *
     * @param request
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/getById.do", method = {RequestMethod.GET})
    @ResponseBody
    public Object getById(HttpServletRequest request, HttpServletResponse response) throws BaseException {
        Long startTm = System.currentTimeMillis();
        BaseLogUtils.info(logger, "getById", "根据主键获取对象.请求参数：" + this.getRequestParameter(request), CurrentThreadContext.getCurrentUserName());

        String id = request.getParameter("id");
        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, "操作成功!");
        if (StringUtils.isEmpty(id)) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo("主键不能为空!");
            BaseLogUtils.error(logger, "getById", "获取数据,主键不存在.[id=" + id + "]", CurrentThreadContext.getCurrentUserName());
            return result;
        }

        try {
            OdrShopClueInfoVO vo = this.odrShopClueInfoService.selectById(Long.valueOf(id));
            if (null == vo) {
                result.setSuccess(BaseConstant.IS_YESNO_NO);
                result.setInfo("数据不存在!");
                BaseLogUtils.info(logger, "getById", "获取数据,数据不存在.[id=" + id + "]", CurrentThreadContext.getCurrentUserName());
            }
            result.setData(vo);
            BaseLogUtils.info(logger, "getById", "获取数据.[id=" + id + "]", CurrentThreadContext.getCurrentUserName());
        } catch (BaseException ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(ex.getMessage());
            BaseLogUtils.info(logger, "getById", "根据主键获取对象失败,主键[" + id + "].", CurrentThreadContext.getCurrentUserName(), ex);
        } catch (Exception ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo("系统错误,请联系管理员!");
            BaseLogUtils.error(logger, "getById", "根据主键获取对象失败,主键[" + id + "].", CurrentThreadContext.getCurrentUserName(), ex);
        }

        Long endTm = System.currentTimeMillis();
        BaseLogUtils.info(logger, "getById", "根据主键获取对象.耗时：" + (endTm - startTm), CurrentThreadContext.getCurrentUserName());

        return result;
    }
    
    /**
     * 导出商家线索记录
     */
    @RequestMapping(value = "/exportOdrShopClueInfoDetail.do", method = {RequestMethod.GET, RequestMethod.POST})
    @ResponseBody
    public DataResultVO exportOdrClueInfoDetail(HttpServletRequest request, HttpServletResponse response) {
        long startTm = System.currentTimeMillis();
        BaseLogUtils.info(logger, "exportOdrClueInfoDetail", "导出商家线索记录.请求参数：" + this.getRequestParameter(request), CurrentThreadContext.getCurrentUserName());

        DataResultVO result = new DataResultVO();
        //设置查询条件
        String splNm = request.getParameter("splNm");				//商家姓名
        String contactsMp = request.getParameter("contactsMp");		//商家手机号
        String rgnProvCd = request.getParameter("rgnProvCd");		//经销商区域：省
        String rgnCityCd = request.getParameter("rgnCityCd");		//经销商区域：市
        String status = request.getParameter("status");				//跟进状态
        String startCrtTm = request.getParameter("startCrtTm");		//线索创建时间：开始
        String endCrtTm = request.getParameter("endCrtTm");			//线索创建时间：结束
        
        OdrShopClueInfoQC qc = new OdrShopClueInfoQC();
        if(StringUtils.isNotEmpty(splNm)){
        	qc.setSplNm(splNm);
        }
        if(StringUtils.isNotEmpty(contactsMp)){
        	qc.setContactsMp(contactsMp);
        }
        if(StringUtils.isNotEmpty(rgnProvCd)){
        	qc.setSplAddressPr(rgnProvCd);
        }
        if(StringUtils.isNotEmpty(rgnCityCd)){
        	qc.setSplAddressCy(rgnCityCd);
        }
        if(StringUtils.isNotEmpty(status)){
        	qc.setStatus(status);
        }
        if(StringUtils.isNotEmpty(startCrtTm)){
        	qc.setStartCrtTm(DateUtils.formatStringToDate(startCrtTm, DateUtils.YYYY_MM_DD));
        }
        if(StringUtils.isNotEmpty(endCrtTm)){
        	qc.setEndCrtTm(DateUtils.formatStringToDate(endCrtTm, DateUtils.YYYY_MM_DD));
        }

        try {
	        String path = this.odrShopClueInfoService.exportOdrShopClueInfoDetail(qc, CurrentThreadContext.getFlServiceSysCd(), CurrentThreadContext.getCurrentOrgCd());
	        if(StringUtils.isNotEmpty(path)){
	        	result.setSuccess(BaseConstant.IS_YESNO_YES);
	        	result.setInfo("导出成功");
	        	result.setData(path);
	        	BaseLogUtils.info(logger, "exportOdrShopClueInfoDetail", "导出商家线索成功", CurrentThreadContext.getCurrentUserName());
	        }
		} catch (BaseException e) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(e.getMessage());
			BaseLogUtils.info(logger, "exportOdrShopClueInfoDetail", "导出商家线索失败.ERROR:" + e.getMessage(), CurrentThreadContext.getCurrentUserName());
		} catch (Exception e) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.info(logger, "exportOdrShopClueInfoDetail", "导出商家线索失败,系统错误..ERROR:" + e.getMessage(), CurrentThreadContext.getCurrentUserName());
		}        
        long endTm = System.currentTimeMillis();
        BaseLogUtils.info(logger, "exportOdrShopClueInfoDetail", "导出商家线索记录，耗时：" + (endTm - startTm), CurrentThreadContext.getCurrentUserName());
        return result;
    }
    
    
    
    
}

